
for k=0,0x100-1 do
    local b = function(a,shift,len)
        local v = bit.rshift(a,shift);
        local mask = bit.lshift(1,len);
        mask = mask - 1;
        return bit.band(v,mask);
    end
    local list = {
        {name='MAP0',v=b(k,0,2)*0x10 + 1},        --图层数据
        {name='MAP1',v=b(k,2,2)*0x10 + 2},
        {name='MAP2',v=b(k,4,2)*0x10 + 3},
        {name='MAP3',v=b(k,6,2)*0x10 + 4},
        {name='OBJ0',v=0x00},
        {name='OBJ1',v=0x10},
        {name='OBJ2',v=0x20},
        {name='OBJ3',v=0x30},
    }

    table.sort(list,function(a,b)
        return a.v>b.v;
    end);
    print(string.format('DEF_VRAM_FUNC(0x%02X,D%s,D%s,D%s,D%s,D%s,D%s,D%s,D%s);',
    k,
    list[1].name,
    list[2].name,
    list[3].name,
    list[4].name,
    list[5].name,
    list[6].name,
    list[7].name,
    list[8].name
    ));
end

